package me.yuxiaoyao.example.jpa.nativesql.controller;

import me.yuxiaoyao.example.jpa.nativesql.repository.NativeSqlRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kerryzhang on 2020/12/16
 */


@RestController
public class NativeSqlController {
    private final NativeSqlRepository nativeSqlRepository;

    public NativeSqlController(NativeSqlRepository nativeSqlRepository) {
        this.nativeSqlRepository = nativeSqlRepository;
    }

    @GetMapping("/")
    public Object index() {
        return nativeSqlRepository.findCustom();
    }

    @GetMapping("/all")
    public Object all() {
        return nativeSqlRepository.findAllDTO();
    }

}
